package comits.business.tiers.dao;

import java.util.List;

import org.hibernate.SQLQuery;
import org.hibernate.context.ManagedSessionContext;

import comits.business.tiers.metiers.AvisCommande;
import comits.business.tiers.orm.hibernate.HibernateSession;

public class AvisCommandeDAOImpl implements AvisCommandeDAO{

	public List<AvisCommande> recupererAvis() {
		SQLQuery sql = HibernateSession.currentSession()
		.createSQLQuery(PropertiesConfig.Get("SelectAllAvis"))
		.addEntity(AvisCommande.class);
//		SQLQuery sql = HibernateSession.currentSession().createSQLQuery("select * from avisCommande");
		List<AvisCommande> list = sql.list();

		ManagedSessionContext.unbind(HibernateSession.getSessionFactory());
		return list;
	}
}
